Save per cpu IDT information into the VMCS host area.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 21 Jul 2005 13:59:49 +0000 (13:59 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 21 Jul 2005 13:59:49 +0000 (13:59 +0000)
Without this, we may be saving the IDT info from the wrong cpu into the
vmcs.
This makes domU work in the presence of VMX domains on SMP/HT enabled
machines.

Signed-off-by: Chengyuan Li <chengyuan.li@intel.com>
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>=20
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
xen/arch/x86/vmx_vmcs.c

index 116a5c513303dc74b3af833fc15d3e27ed140a42..a8a01c7808433ce898590509492f3ffeac0254f5 100644 (file)
@@ -190,10 +190,14 @@ void vmx_do_launch(struct vcpu *v)
 
     vmx_setup_platform(v, regs);
 
+    __asm__ __volatile__ ("sidt  (%0) \n" :: "a"(&desc) : "memory");
+    host_env.idtr_limit = desc.size;
+    host_env.idtr_base = desc.address;
+    error |= __vmwrite(HOST_IDTR_BASE, host_env.idtr_base);
     __asm__ __volatile__ ("sgdt  (%0) \n" :: "a"(&desc) : "memory");
     host_env.gdtr_limit = desc.size;
     host_env.gdtr_base = desc.address;
-
     error |= __vmwrite(HOST_GDTR_BASE, host_env.gdtr_base);
 
     error |= __vmwrite(GUEST_LDTR_SELECTOR, 0);
@@ -351,7 +355,6 @@ static inline int construct_vmcs_host(struct host_execution_env *host_env)
 {
     int error = 0;
     unsigned long crn;
-    struct Xgt_desc_struct desc;
 
     /* Host Selectors */
     host_env->ds_selector = __HYPERVISOR_DS;
@@ -377,14 +380,7 @@ static inline int construct_vmcs_host(struct host_execution_env *host_env)
     host_env->ds_base = 0;
     host_env->cs_base = 0;
 
-/* Debug */
-    __asm__ __volatile__ ("sidt  (%0) \n" :: "a"(&desc) : "memory");
-    host_env->idtr_limit = desc.size;
-    host_env->idtr_base = desc.address;
-    error |= __vmwrite(HOST_IDTR_BASE, host_env->idtr_base);
-
     __asm__ __volatile__ ("mov %%cr0,%0" : "=r" (crn) : );
-
     host_env->cr0 = crn;
     error |= __vmwrite(HOST_CR0, crn); /* same CR0 */
 
@@ -392,6 +388,7 @@ static inline int construct_vmcs_host(struct host_execution_env *host_env)
     __asm__ __volatile__ ("mov %%cr4,%0" : "=r" (crn) : ); 
     host_env->cr4 = crn;
     error |= __vmwrite(HOST_CR4, crn);
+
     error |= __vmwrite(HOST_RIP, (unsigned long) vmx_asm_vmexit_handler);
 #ifdef __x86_64__ 
     /* TBD: support cr8 for 64-bit guest */